		<?php if(!empty($hanghoabhlds) && !empty($chitieungaybhlds)) {?>
			<table id ='tables'>
				<tr>
				<th rowspan=3>STT</th>
				<th rowspan=3>Đội</th>
				<th rowspan=3>Địa Điểm</th>
				<th rowspan=3>Ngày</th>
				<th rowspan=3>Thành viên tham gia</th>
				<th colspan=<?php echo count($hanghoabhlds)?>>Chỉ tiêu</th>
				<th rowspan=3>Ghi chú</th>
				<th rowspan=3>Thao tác</th>
				</tr>
				<tr>
				<?php foreach ($hanghoabhlds as $keyhh =>$valhh):?>
				<th colspan=3><?php echo $valhh ?></th>
				<?php endforeach;?>
				</tr>
				<tr>
				<?php foreach ($hanghoabhlds as $keyhh =>$valhh):?>
				<th>Chỉ Tiêu</th>
				<th>Kết quả</th>
				<th>% Hoàn Thành </th>
				<?php endforeach;?>
				</tr>
				<?php
					$i=0; 
					 foreach ($chitieungaybhlds as $chitieungay):
					  $i++;
				?>
				<tr>
				<td><?php echo $i?></td>
				<td><?php echo $chitieungay['Kehoachbhld']['tendoi']?></td>
				<td><?php echo $chitieungay['Kehoachbhld']['diadiem']?></td>
				<td><?php echo date('d-m-Y',strtotime($chitieungay['Kehoachbhld']['thoigian']))?></td>
				<td><?php echo $chitieungay['Kehoachbhld']['nhansu']?></td>
				<?php foreach ($hanghoabhlds as $keyhh =>$valhh):?>
				<td>
				<?php
					foreach ($chitieungay['Chitieungay'] as $ctngay)
					{
						if($ctngay['hanghoa_id']==$keyhh)
				 			echo $ctngay['soluong'];	
					}
				?>
				</td>
				<td>
				<?php
					foreach ($chitieungay['Chitieungay'] as $ctngay)
					{
						if($ctngay['hanghoa_id']==$keyhh)
				 			echo $ctngay['ketqua'];	
					}
				?>
				</td>
				<td>
				<?php
					foreach ($chitieungay['Chitieungay'] as $ctngay)
					{
						if($ctngay['hanghoa_id']==$keyhh)
				 			echo number_format(round($ctngay['ketqua']*100/$ctngay['soluong'],2),0,',','.');	
					}
				?>
				</td>
				<?php endforeach;?>
				<td><?php echo $chitieungay['Kehoachbhld']['ghichu']?></td>
				<td>
				<?php echo $html->link('Sửa kết quả bán hàng',array('controller'=>'chitieungays','action'=>'nhapkqbanhang',$chitieungay['Kehoachbhld']['nhanvien_id']));?>
				</td>
				</tr>
				<?php endforeach;?> 
				</table>
					<p>
					<?php
					echo $this->Paginator->counter(array(
					'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
					));
					?>	</p>
				
					<div class="paging">
						<?php echo $this->Paginator->prev('<< ' . __('Trước', true), array(), null, array('class'=>'disabled'));?>
					 | 	<?php echo $this->Paginator->numbers();?>
				 |
						<?php echo $this->Paginator->next(__('Sau', true) . ' >>', array(), null, array('class' => 'disabled'));?>
					</div>
					<?php }else{echo "<h2>Không có dữ liệu</h2>";} ?>